// 模拟数据
import inviteList from "./inviteList.js";


//获取邀请记录列表
export function getInviteList(pageNum, pageSize) {
	return new Promise((resolute, reject) => {
		//延时一秒,模拟联网
		setTimeout(() => {
			try {
				// 模拟搜索
				let list = []

				// 模拟评论
				for (let i = (pageNum - 1) * pageSize; i < pageNum * pageSize; i++) {
					if (i === inviteList.length) break
					list.push(inviteList[i])
				}


				resolute(list);
			} catch (e) {
				//模拟接口请求失败
				reject(e);
			}
		}, 1000)
	})
}
//获取访客详情
export function getInviteInfo(id) {
	return new Promise((resolute, reject) => {
		//延时一秒,模拟联网
		setTimeout(function() {
			try {
				let dat = {};
				for (let i in inviteList) {
					if (inviteList[i].id == id) {
						dat = inviteList[i];
					}
				}

				//模拟接口请求成功
				resolute(dat);
			} catch (e) {
				//模拟接口请求失败
				reject(e);
			}
		}, 1000)
	})
}

//获取停车点
import point from "./point.js";
export function getPointApi(id) {
	return new Promise((resolute, reject) => {
		//延时一秒,模拟联网
		setTimeout(function() {
			try {
				//模拟接口请求成功
				let dat = {};
				for (let i in point) {
					if (point[i].id == id) {
						dat = point[i];
						break;
					}
				}
				resolute(dat);
			} catch (e) {
				//模拟接口请求失败
				reject(e);
			}
		}, 1000)
	})
}

